package com.flycent.hqhs.bean;

import java.util.List;



/**
 * @author fbl
 *  订单列表
 */
public class OrderList {
	
	//---------------------------------------------------
	
	// 列表中带有的属性
	/** 订单编号  */
	private long sn;
	/** 创建时间  */
	private long createDate;
	/**  订单名 */
	private String name;
	/** 订单价格 */
	private float price;
	/** 订单状态 */
	private OrderStatus orderStatus;
	/** 支付状态*/
	private String paymentStatus;
	/**  是否评论 */
	private boolean reviewStatus;
	/**  是否晒单 */
	private boolean sunSingleStatus;
	/** 订单商品 */
	private List<OrderItemDTOs> orderItemDTOs;
	
	// detail 中 的属性
	/** 收货人 */
	private String consignee;
	/** 地区名称 */
	private String areaName;
	/** 地址 */
	private String address;
	/** 邮编 */
	private String zipCode;
	/** 电话 */
	private String phone;
	/** 是否开据发票 */
	private Boolean isInvoice;
	/** 发票抬头 */
	private String invoiceTitle;
	/** 物流公司名称 */
	private String deliveryCorpName;
	/** 运费 */
	private float freight;
	/** 物流编号 */
	private String trackingNo;
	/**  */
	private float amountPaid;
	/**  */
	private float amountPayable;
	

	public float getAmountPaid() {
		return amountPaid;
	}

	public void setAmountPaid(float amountPaid) {
		this.amountPaid = amountPaid;
	}

	public float getAmountPayable() {
		return amountPayable;
	}

	public void setAmountPayable(float amountPayable) {
		this.amountPayable = amountPayable;
	}

	public OrderList() {
		super();
	}

	public OrderList(long sn, long createDate, String name, float price,
			OrderStatus orderStatus, String paymentStatus, boolean reviewStatus,
			List<OrderItemDTOs> orderItemDTOs, String consignee,
			String areaName, String address, String zipCode, String phone,
			Boolean isInvoice, String invoiceTitle, String deliveryCorpName,
			float freight) {
		super();
		this.sn = sn;
		this.createDate = createDate;
		this.name = name;
		this.price = price;
		this.orderStatus = orderStatus;
		this.paymentStatus = paymentStatus;
		this.reviewStatus = reviewStatus;
		this.orderItemDTOs = orderItemDTOs;
		this.consignee = consignee;
		this.areaName = areaName;
		this.address = address;
		this.zipCode = zipCode;
		this.phone = phone;
		this.isInvoice = isInvoice;
		this.invoiceTitle = invoiceTitle;
		this.deliveryCorpName = deliveryCorpName;
		this.freight = freight;
	}

	@Override
	public String toString() {
		return "OrderList [sn=" + sn + ", createDate=" + createDate + ", name="
				+ name + ", price=" + price + ", orderStatus=" + orderStatus 
				+ ", paymentStatus = " + paymentStatus + ", reviewStatus=" 
				+ reviewStatus + ", orderItemDTOs="	+ orderItemDTOs 
				+ ", consignee=" + consignee + ", areaName=" + areaName 
				+ ", address=" + address + ", zipCode=" + zipCode
				+ ", phone=" + phone + ", isInvoice=" + isInvoice
				+ ", invoiceTitle=" + invoiceTitle + ", deliveryCorpName="
				+ deliveryCorpName + ", freight=" + freight + "]";
	}

	
	public boolean isSunSingleStatus() {
		return sunSingleStatus;
	}

	public void setSunSingleStatus(boolean sunSingleStatus) {
		this.sunSingleStatus = sunSingleStatus;
	}

	public String getTrackingNo() {
		return trackingNo;
	}

	public void setTrackingNo(String trackingNo) {
		this.trackingNo = trackingNo;
	}

	public boolean isReviewStatus() {
		return reviewStatus;
	}

	public void setReviewStatus(boolean reviewStatus) {
		this.reviewStatus = reviewStatus;
	}

	public String getConsignee() {
		return consignee;
	}

	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}

	public String getAreaName() {
		return areaName;
	}

	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Boolean getIsInvoice() {
		return isInvoice;
	}

	public void setIsInvoice(Boolean isInvoice) {
		this.isInvoice = isInvoice;
	}

	public String getInvoiceTitle() {
		return invoiceTitle;
	}

	public void setInvoiceTitle(String invoiceTitle) {
		this.invoiceTitle = invoiceTitle;
	}

	public String getDeliveryCorpName() {
		return deliveryCorpName;
	}

	public void setDeliveryCorpName(String deliveryCorpName) {
		this.deliveryCorpName = deliveryCorpName;
	}

	public float getFreight() {
		return freight;
	}

	public void setFreight(float freight) {
		this.freight = freight;
	}

	public long getSn() {
		return sn;
	}

	public void setSn(long sn) {
		this.sn = sn;
	}

	public long getCreateDate() {
		return createDate;
	}

	public void setCreateDate(long createDate) {
		this.createDate = createDate;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}
	
	
	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}

	public PaymentStatus getPaymentStatus() {
		return PaymentStatus.parse(paymentStatus);
	}

	public void setPaymentStatus(String paymentStatus) {
		this.paymentStatus = paymentStatus;
	}

	public List<OrderItemDTOs> getOrderItemDTOs() {
		return orderItemDTOs;
	}

	public void setOrderItemDTOs(List<OrderItemDTOs> orderItemDTOs) {
		this.orderItemDTOs = orderItemDTOs;
	}


	public static class OrderItemDTOs{
		/**   */
		private long id ;
		/**   */
		private int quantity;
		/**   */
		private Product item;
		/**
		 * @return the id
		 */
		public long getId() {
			return id;
		}
		/**
		 * @param id the id to set
		 */
		public void setId(long id) {
			this.id = id;
		}
		/**
		 * @return the quantity
		 */
		public int getQuantity() {
			return quantity;
		}
		/**
		 * @param quantity the quantity to set
		 */
		public void setQuantity(int quantity) {
			this.quantity = quantity;
		}
		/**
		 * @return the item
		 */
		public Product getItem() {
			return item;
		}
		/**
		 * @param item the item to set
		 */
		public void setItem(Product item) {
			this.item = item;
		}
		
	}

	/**
	 * 订单状态
	 */
	public enum OrderStatus {

		NA,
		
		/** 未付款 */
		unconfirmed ,

		/** 已确认 */
		confirmed,

		/** 已接单 */
		orderReceived,

		/** 验货中 */
		stockVerifying,

		/** 采购中 */
		purchasing,

		/** 拣货中 */
		picking,

		/** 发货中 */
		shipping,

		/** 退货中 */
		returning,

		/** 退货完成 */
		returned,

		/** 换货中 */
		exchanging,

		/** 换货完成 */
		exchanged,

		/** 待确认 */
		toBeConfirmed,

		/** 已完成 */
		completed,

		/** 已取消 */
		cancelled;
		
		private static final String UNCONFIRMED = "unconfirmed";
		private static final String CONFIRMED = "confirmed";

		private static final String CANCELED = "cancelled";
		private static final String ORDERRECEIVED = "orderReceived";
		private static final String STOCKVERFYING = "stockVerifying";
		private static final String PURCHASING = "purchasing";
		private static final String PICKING = "picking";
		private static final String RETURNING = "returning";
		private static final String EXCHANGING = "exchanging";	
		private static final String TOBECONFIRMED = "toBeConfirmed";
		private static final String SHIPPING = "shipping";
		private static final String RETURNED = "returned";
		private static final String EXCHANGED = "exchanged";
		private static final String COMPLETED = "completed";
		
		public static OrderStatus parse(String status){
			
			OrderStatus orderStatus = OrderStatus.NA;
			
			switch (status) {
			case UNCONFIRMED:
				orderStatus  = OrderStatus.unconfirmed;
				break;
			case CONFIRMED:
				orderStatus = OrderStatus.confirmed;
				break;
				
			case PICKING:
				orderStatus = OrderStatus.picking;
				break;
				
			case CANCELED:
				orderStatus = OrderStatus.cancelled;
				break;
				
			case ORDERRECEIVED:
				orderStatus = OrderStatus.orderReceived;
				break;	
			case STOCKVERFYING:
				orderStatus = OrderStatus.stockVerifying;
				break;
			case PURCHASING:
				orderStatus = OrderStatus.purchasing;
				break;
			case RETURNING:
				orderStatus = OrderStatus.returning;
				break;
			case EXCHANGING:
				orderStatus = OrderStatus.exchanging;
				break;
			case TOBECONFIRMED:
				orderStatus = OrderStatus.toBeConfirmed;
				break;
			case SHIPPING:
				orderStatus = OrderStatus.shipping;
				break;
			case RETURNED:
				orderStatus = OrderStatus.returned;
				break;
			case EXCHANGED:
				orderStatus = OrderStatus.exchanged;
				break;				
			case COMPLETED:
				orderStatus = OrderStatus.completed;
				break;
			default:
				break;
			}
			
			return orderStatus;
			
		}
		
		
		
	}
	
	/**
	 * 支付状态
	 */
	public enum PaymentStatus{
		
		NA,
		unpaid,
		partialPayment,
		paid,
		partialRefunds,
		refunded;
		
		private static final String UNPAID = "unpaid";
		private static final String PARTIALPAYMENT = "partialPayment";
		private static final String PAID = "paid";		
		private static final String PARTIALREFUNDS = "partialRefunds";
		private static final String REFUNDED = "refunded";		
		
		public static PaymentStatus parse(String status){
			
			PaymentStatus paymentStatus = PaymentStatus.NA;
			
			switch (status) {
			case UNPAID:
				paymentStatus = PaymentStatus.unpaid;
				break;
			case PARTIALPAYMENT:
				paymentStatus = PaymentStatus.partialPayment;
				break;
			case PAID:
				paymentStatus = PaymentStatus.paid;
				break;
			case PARTIALREFUNDS:
				paymentStatus = PaymentStatus.partialRefunds;
				break;
			case REFUNDED:
				paymentStatus = PaymentStatus.refunded;
				break;

			default:
				break;
			}
			
			return paymentStatus;
			
		}
	}




}
